<#include "../common/layout/__mainlayout.html">
<#include "../common/__pagination.html">

        <!--设置面包屑-->
        <#assign pageBreadCrumbs>
            <li class="active"><a href="#">应用管理</a></li>
            <li class="active">标签管理</li>
        </#assign>

        <#assign pageCss>
            <!-- page specific plugin styles -->
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/jquery-ui.custom.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/chosen.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/datepicker.css"/>
            <link rel="stylesheet" href="${ctx}/static/admin/assets/css/daterangepicker.css"/>

        </#assign>

        <#assign pageJavascript>
            <script type="text/javascript">

                $(document).ready(function () {

                    $("#state").val(${query.state!});

                    $('[data-rel=tooltip]').tooltip();

                    if (!ace.vars['touch']) {
                        $('.chosen-select').chosen({allow_single_deselect: true});
                    }

                    // 清除远程modal数据
                    $("#editModal").on("hidden.bs.modal", function () {
                        $(this).removeData("bs.modal");
                    });

                    //初始化范围选择器
                    $('input[name=createTimeRange]').daterangepicker({
                        'applyClass': 'btn-sm btn-success',
                        'cancelClass': 'btn-sm btn-default',
                        locale: {
                            applyLabel: '确定',
                            cancelLabel: '取消'
                        }
                    });

                    //初始化范围选择器
                    $('input[name=startTimeRange]').daterangepicker({
                        'applyClass': 'btn-sm btn-success',
                        'cancelClass': 'btn-sm btn-default',
                        locale: {
                            applyLabel: '确定',
                            cancelLabel: '取消'
                        }
                    });

                    // 删除按钮
                    $("a.delete").on(ace.click_event, function (e) {
                        var currentA = this;
                        e.preventDefault();
                        bootbox.confirm({
                                    message: "确定删除该专题?",
                                    buttons: {
                                        confirm: {
                                            label: "确定",
                                            className: "btn-primary btn-sm"
                                        },
                                        cancel: {
                                            label: "取消",
                                            className: "btn-sm"
                                        }
                                    },
                                    callback: function (result) {
                                        if (result) {
                                            $.get($(currentA).attr("href"), { },function(data){
                                                if(data){
                                                    window.location="${ctx}/admin/softTag/softTagList.do";
                                                }
                                            });
                                        }
                                    }
                                }
                        );
                    });
                });
            </script>
        </#assign>

        <@mainlayout pageBreadCrumbs=pageBreadCrumbs pageCss=pageCss pageJavascript=pageJavascript  currentMenu="ApplicationFlag-softTagListFlag">
        <div class="row">
            <div class="col-xs-12">
                <form id="searchForm" class="form-search form-inline" action="/admin/softTag/softTagList.do">
                    <div class="row">
                        <div class="widget-body">
                            <div class="widget-main">
                                <div class="form-group  col-xs-12" style="padding-top:10px">
                                    <label class="col-xs-1 text-right" for="tagName">标签名称:</label>
                                    <input type="text" id="tagName" name="tagName" class="input-sm col-xs-2"  value="${query.tagName!}"/>
                                    <label class="col-xs-1 text-right"for="state">状态:</label>
                                    <select class="col-xs-1" name="state" id="state"  data-placeholder="状态">
                                        <option value="-99">全部</option>
                                        <option value="1">显示</option>
                                        <option value="0">删除</option>
                                    </select>
                                        <input type="button" id="searchBtn" class="btn btn-sm btn-primary" value="查询"/>&nbsp;
                                        <a href="${ctx}/admin/softTag/viewTag.do" class="btn btn-sm btn-warning" ><i class="ace-icon fa fa-plus"></i>添加</a>
                                </div>

                            </div>
                        </div>
                    </div>

                <table id="softTagTable" class="table table-striped table-bordered table-hover">
                    <thead>
                    <tr>
                        <th width="40" align="center">标签编号</th>
                        <th width="100" align="left">名称</th>
                        <th width="100" align="left">排序</th>
                        <th width="160" align="left">状态</th>
                        <th width="70" align="center">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <#list softTagPage.listData as softTag>
                        <tr>
                            <td>${softTag.tagId!}</td>
                            <td>${softTag.tagName!}</td>
                            <td>${softTag.sortIndex!}</td>
                            <td>
                             <#if softTag.state == 0>
                                显示
                                <#elseif  softTag.state = -1>
                                删除
                                <#else>
                            </#if>
                            </td>
                            <td>
                                <div class="hidden-sm hidden-xs action-buttons">
                                    <a class="green tooltip-success edit"
                                       href="${ctx}/admin/softTag/viewTag.do?tagId=${softTag.tagId!}"><span
                                            class="label label-success">修改</span></a>
                                    <a class="red tooltip-error delete"
                                       href="${ctx}/admin/softTag/deleteTag.do?tagId=${softTag.tagId!}" data-rel="tooltip"
                                       title="删除"> <span class="label label-danger">删除</span></a>
                                    <a href="${ctx}/admin/softTag/listTagSoftMap.do?tagId=${softTag.tagId!}" class="tooltip-warning resc" data-rel="tooltip"
                                       title="已打标签"><span class="label label-warning">已打标签</span></a>
                                </div>

                            </td>
                        </tr>
                    </#list>
                    </tbody>
                </table>
                <@pagination softTagPage!/>
            </div>
        </div>
    </form>

    <div id="editModal" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
            </div>
        </div>
    </div>
    </@mainlayout>